package com.atguigu.demo02_minio.config;

import jakarta.annotation.PostConstruct;
import jdk.jfr.DataAmount;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
@ConfigurationProperties(prefix = "stgy.minio")
public class MinioConfig {
    private String url;
    private String username;
    private String password;
    private String bucket;

    public static String URL;
    public static String USERNAME;
    public static String PASSWORD;
    public static String BUCKET;
    // 作用和 spring InitializingBean的afterPropertiesSet方法作用一样，都是在组件对象创建成功后调用一次
    @PostConstruct
    public void init() {
        URL = this.url;
        USERNAME = this.username;
        PASSWORD = this.password;
        BUCKET = this.bucket;
    }
}
